<template>
  <!-- 评估模型维护 -->
  <div class="app-container2 pinggumoxingweihu">
    <div class="left_box">
      <commonTree2 />
    </div>
    <div class="right-box">
      <div class="modal-search-box">
        <div class="top">
          <div class="left">
            <div class="form-item time-box">
              <div class="label">创建时间：</div>
              <el-date-picker
                class="jk_common_date_picker"
                v-model="timeVal"
                type="daterange"
                size="mini"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :append-to-body="false"
              >
              </el-date-picker>
            </div>
            <div class="form-item select-box">
              <div class="label">设备类型：</div>
              <el-select
                class="js_common_select"
                v-model="shebeiTypeVal"
                size="mini"
                placeholder="请选择"
                :popper-append-to-body="false"
              >
                <el-option
                  v-for="item in shebeiOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </div>
            <div class="form-item">
              <div class="label">设备名称：</div>
              <el-input
                class="js_common_input"
                size="mini"
                v-model="shebeiNameVal"
                placeholder="请输入"
              ></el-input>
            </div>
          </div>

          <el-button class="js_common_btn colorStyle" size="mini"
            >评估模型查询</el-button
          >
        </div>
      </div>
      <div class="right_main">
        <div class="right_main_bottom">
          <el-table
            class="jk_common_table004"
            :data="tableData2"
            height="style"
            border
            style="width: 100%; height: 100%"
          >
            <el-table-column prop="id" label="编号" width="180" align="center">
            </el-table-column>
            <el-table-column
              prop="name"
              label="模型名称"
              width="180"
              align="center"
            >
            </el-table-column>
            <el-table-column prop="createTime" label="创建日期" align="center">
            </el-table-column>
            <el-table-column prop="renyuan" label="创建人员" align="center">
            </el-table-column>
            <el-table-column prop="shebei" label="设备名称" align="center">
            </el-table-column>
            <el-table-column prop="type" label="设备类型" align="center">
            </el-table-column>
            <el-table-column prop="operate" label="操作" align="center">
              <template>
                <el-button type="text" size="small">点击查看</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="right_main_top">
          <div class="common_title_wrap">
            <div class="common_title_btn">加载层级模型</div>
          </div>
          <div class="right_content_wrap">
            <treeChart :treeChartData="treeChartData" />
          </div>
        </div>
        <div class="right_main_center">
          <div class="center_items11">
            <div class="common_title_wrap">
              <div class="common_title_btn">加载判断矩阵</div>
            </div>
            <div class="items11_content">
              <div class="duizhanbiao_table">
                <el-table
                  height="style"
                  border
                  class="jk_common_table004"
                  :data="tableData"
                  style="width: 100%; height: 100%"
                >
                  <el-table-column prop="name" label=""></el-table-column>
                  <el-table-column
                    v-for="item in tableData"
                    :key="item.id"
                    :label="item.name"
                  >
                    <template slot-scope="scope">
                      <div
                        class="table_checkout_box"
                        v-if="
                          checkoutTableItemFn(item.id, scope.row.checkIdArr)
                        "
                      >
                        <div class="icon el-icon-check"></div>
                      </div>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </div>
          <div class="center_items11">
            <div class="common_title_wrap">
              <div class="common_title_btn">一致性检验</div>
              <div class="common_title_btn_right">模型优化更新</div>
            </div>
            <div class="items11_content">
              <div class="common_main_scrollbar_content">
                <el-scrollbar class="el-scrollbar-bai"> </el-scrollbar>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import commonTree2 from "../../../components/commonTree2";
import treeChart from "./components/treeChart";

export default {
  components: { treeChart, commonTree2 },
  data() {
    return {
      treeChartData: [
        {
          name: "xx设备健康度",
          relationType: 0,
          children: [
            {
              name: "因子1",
            },
            {
              name: "因子2",
            },
            {
              name: "因子3",
            },
            {
              name: "因子4",
            },
            {
              name: "因子5",
            },
            {
              name: "因子6",
            },
            {
              name: "因子7",
            },
            {
              name: "因子8",
            },
            {
              name: "因子M",
            },
          ],
        },
      ],
      timeVal: "",
      shebeiTypeVal: "",
      shebeiNameVal: "",
      shebeiOptions: [
        {
          value: "选项1",
          label: "历史服务器",
        },
        {
          value: "选项2",
          label: "计算服务器",
        },
        {
          value: "选项3",
          label: "控制站",
        },
        {
          value: "选项4",
          label: "操作员站",
        },
      ],
      tableData: [
        {
          id: "1",
          name: "因子1",
          checkIdArr: ["2"],
        },
        {
          id: "2",
          name: "因子2",
          checkIdArr: ["4"],
        },
        {
          id: "3",
          name: "因子3",
          checkIdArr: ["2"],
        },
        {
          id: "4",
          name: "因子4",
          checkIdArr: ["2"],
        },
        {
          id: "5",
          name: "因子5",
          checkIdArr: ["2"],
        },
        {
          id: "6",
          name: "因子6",
          checkIdArr: ["2"],
        },
      ],
      tableData2: [
        {
          id: "0000001",
          name: "评估模型1",
          createTime: "2019-09-09",
          renyuan: "员工1",
          shebei: "设备1",
          type: "设备类型1",
        },
        {
          id: "0000002",
          name: "评估模型2",
          createTime: "2019-09-10",
          renyuan: "员工2",
          shebei: "设备2",
          type: "设备类型2",
        },
      ],
    };
  },
  methods: {
    checkoutTableItemFn(id, checkIdArr) {
      console.log(id, checkIdArr);
      let flag = checkIdArr.some((item) => {
        return item === id;
      });
      console.log(flag);
      return flag;
    },
  },
};
</script>

<style lang="scss" scoped>
$modelCreatebgColor: #0e2141;
.pinggumoxingweihu {
  width: 100%;
  display: flex;
  ::v-deep .colorStyle {
    span {
      color: #ccc !important;
    }
  }
  .left_box {
    flex: 0 0 auto;
  }
  .right-box {
    flex: 1 1 auto;
    width: 0;
    margin-left: 15px;
    background: #163368;
    display: flex;
    flex-direction: column;
    .modal-search-box {
      flex: 0 0 auto;
      padding-top: 32px;
      margin-bottom: 18px;
      .top {
        display: flex;
        justify-content: space-between;
        padding: 0 23px;
        .left {
          display: flex;
          .form-item {
            display: flex;
            align-items: center;
            margin-right: 28px;
            &.select-box {
              width: 300px;
            }
            &.time-box {
              width: 300px;
            }
            .label {
              color: #cbcbcb;
              flex-shrink: 0;
              font-size: 14px;
              margin-right: 3px;
            }
          }
        }
      }
    }
    .cengji-chart-box {
      width: 100%;
      height: 220px;
    }
    .right_main {
      flex: 1 1 auto;
      width: 100%;
      height: 0;
      display: flex;
      flex-direction: column;
      .right_main_top,
      .right_main_bottom {
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        border: 2px solid #21569f;
        background-color: #0f2245;
      }
      .right_main_bottom {
        border: none;
      }
      .right_main_top {
        flex: 0 0 auto;
        height: 260px;
        display: flex;
        flex-direction: column;
        .right_content_wrap {
          height: 0;
          flex: 1 1 auto;
          width: 100%;
          background-color: $modelCreatebgColor;
        }
      }
      .right_main_center {
        flex: 5 1 auto;
        display: flex;
        margin: 16px 0;
        height: 0;
        justify-content: space-between;
        .center_items11 {
          width: 48%;
          height: 100%;
          box-sizing: border-box;
          border: 2px solid #21569f;
          display: flex;
          flex-direction: column;
          .items11_content {
            flex: 1 1 auto;
            width: 100%;
            height: 0;
            background-color: $modelCreatebgColor;
          }
        }
      }
      .right_main_bottom {
        flex: 4 1 auto;
        width: 100%;
        height: 0;
        margin-bottom: 18px;
        background-color: #122b56;
        .right_content_wrap {
          flex: 1 1 auto;
          width: 100%;
          height: 0;
          background: $modelCreatebgColor;
        }
      }
      .common_title_wrap {
        flex: 0 0 auto;
        width: 100%;
        height: 62px;
        background: linear-gradient(to bottom, #134183, #113b78);
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-sizing: border-box;
        padding: 0 20px;
        .common_title_btn {
          width: 160px;
          text-align: center;
          font-size: 20px;
          height: 32px;
          line-height: 32px;
          color: #ccc;
          // background: linear-gradient(to right, #247ab7, #279cce, #247ab7);
          background: linear-gradient(to right, #1f589e, #2384b5, #1f589e);
          cursor: pointer;
          &:hover {
            opacity: 0.9;
          }
        }
        .common_title_btn_right {
          width: 160px;
          text-align: center;
          font-size: 20px;
          height: 32px;
          line-height: 32px;
          color: #ccc;
          background: linear-gradient(to right, #1f589e, #2384b5, #1f589e);
          // background: linear-gradient(to right, #247ab7, #279cce, #247ab7);
          cursor: pointer;
          &:hover {
            opacity: 0.9;
          }
        }

        .common_title_other {
          display: flex;
          align-items: center;
          .other_search_wrap {
            display: flex;
            align-items: center;
            margin-right: 100px;
            .search_name {
              color: #ccc;
              font-size: 20px;
              margin-right: 8px;
            }
          }
        }
      }
      .common_main_scrollbar_content {
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        padding: 20px;
        font-size: 20px;
        color: #ccc;
        line-height: 32px;
        background: linear-gradient(to bottom, #12315e, #154173);
      }
      .duizhanbiao_table {
        width: 100%;
        height: 100%;
        background-color: #122b56;
        .table_checkout_box {
          display: flex;
          align-items: center;
          justify-content: center;
          .icon {
            font-weight: 700;
            font-size: 18px;
          }
        }
      }
    }
  }
}
</style>
